﻿using System;
using System.Linq;
using NUnit.Framework;
using ProjetoComperio.Framework.Web.Logging;

namespace ProjetoComperio.Test.ComperioFramework.Web.Logging
{
    [TestFixture]
    public class LoggerTest
    {
        [Test]
        public void TestStoreException()
        {
            ExceptionLogging exceptionLogging = new ExceptionLogging();
            exceptionLogging.Date = DateTime.Now;
            exceptionLogging.Message = "Just Test";
            exceptionLogging.Source = "Source";
            exceptionLogging.StackTrace = "Stack Trace";
            exceptionLogging.TargetSite = "TargetSite";
            exceptionLogging.URL = "URL";
            exceptionLogging.UserAgent = "UserAgent";
            exceptionLogging.UserName = "UserName";
            Logger.StoreException(exceptionLogging);
            Assert.IsTrue(Logger.RetrieveExceptions().Any(el => el.ExceptionLoggingID == exceptionLogging.ExceptionLoggingID));

        }
        [Test]
        public void TestGetExceptions()
        {
            Assert.IsTrue(Logger.RetrieveExceptions() is IQueryable<ExceptionLogging>);


        }

    }
}
